<template>
	<view>
		<view class="wrap">
			<view class="u-tabs-box">
				<!-- <u-tabs-swiper activeColor="#f29100" ref="tabs" :list="list" :current="current" @change="change" :is-scroll="false" swiperWidth="750"></u-tabs-swiper> -->
				
				<u-tabs v-if="control" bg-color="#fafafa" :bold="bold" :active-color="activeColor" :list="list"
				@change="change" :current="current" :is-scroll="isScroll" :offset="offset"></u-tabs>
			</view>
			<swiper class="swiper-box" :current="swiperCurrent">
				<!-- 1 -->
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<u-table>
								<u-tr class="u-tr">
									<u-th class="u-th">项目</u-th>
									<u-th class="u-th">日期</u-th>
									<u-th class="u-th">当天成交</u-th>
									<u-th class="u-th">上届当天</u-th>
									<u-th class="u-th">当日同比</u-th>
									<u-th class="u-th">累计成交</u-th>
									<u-th class="u-th">上届累计</u-th>
									<u-th class="u-th">累计同比</u-th>
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList" :key="index">
									<u-td class="u-td">{{item.name}}</u-td>
									<u-td class="u-td">{{item.date}}</u-td>
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
								</u-tr>
							</u-table>							
						</view>
					</scroll-view>
				</swiper-item>
				
				<!-- 2 -->
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<u-table>
								<u-tr class="u-tr">
									<u-th class="u-th">交易团名称</u-th>
									<u-th class="u-th">当天成交</u-th>
									<u-th class="u-th">上届当天</u-th>
									<u-th class="u-th">当日同比</u-th>
									<u-th class="u-th">累计成交</u-th>
									<u-th class="u-th">上届累计</u-th>
									<u-th class="u-th">累计同比</u-th>
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList1" :key="index">
									<u-td class="u-td">{{item.name}}</u-td>
							
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
									</u-tr>
								</u-table>							
						</view>
					</scroll-view>
				</swiper-item>

					
				<!-- 3 -->
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<u-table>
								<u-tr class="u-tr">
									<u-th class="u-th">国别和地区</u-th>
								
									<u-th class="u-th">当天成交</u-th>
									<u-th class="u-th">上届当天</u-th>
									<u-th class="u-th">当日同比</u-th>
									<u-th class="u-th">累计成交</u-th>
									<u-th class="u-th">上届累计</u-th>
									<u-th class="u-th">累计同比</u-th>
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList2" :key="index">
									<u-td class="u-td">{{item.name}}</u-td>
								
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
									</u-tr>
								</u-table>							
						</view>
					</scroll-view>
				</swiper-item>			
				<!-- 4 -->
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<u-table>
								<u-tr class="u-tr">
									<u-th class="u-th">交易团名称</u-th>
							
									<u-th class="u-th">当天成交</u-th>
									
									<u-th class="u-th">累计成交</u-th>
									<u-th class="u-th">港澳</u-th>
									<u-th class="u-th">台湾</u-th>
									<u-th class="u-th">日本</u-th>
									<u-th class="u-th">韩国</u-th>
									<u-th class="u-th">印度</u-th>
									<u-th class="u-th">东盟</u-th>
																	
									<u-th class="u-th">中东</u-th>
									<u-th class="u-th">海湾六国</u-th>
									<u-th class="u-th">非洲</u-th>
									<u-th class="u-th">欧盟</u-th>
									<u-th class="u-th">俄罗斯</u-th>
									<u-th class="u-th">美国</u-th>
									<u-th class="u-th">加拿大</u-th>
									<u-th class="u-th">中南美洲</u-th>
									<u-th class="u-th">澳大利亚</u-th>
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList3" :key="index">
									<u-td class="u-td">{{item.name}}</u-td>
								
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
									</u-tr>
								</u-table>							
												
						</view>
					</scroll-view>
				</swiper-item>
						
				<!-- 5 -->
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<u-table>
								<u-tr class="u-tr">
									
									<u-th class="u-th">企业性质</u-th>
									<u-th class="u-th">当天成交</u-th>
									<u-th class="u-th">所占比例</u-th>
									<u-th class="u-th">当日同比</u-th>
									<u-th class="u-th">累计成交</u-th>
									<u-th class="u-th">所占比例</u-th>
									<u-th class="u-th">累计同比</u-th>
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList4" :key="index">
									<u-td class="u-td">{{item.name}}</u-td>
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
								</u-tr>
							</u-table>							
							<u-table>
								<u-tr class="u-tr">
									
									<u-th class="u-th">社会属性</u-th>
									<u-th class="u-th">当天成交</u-th>
									<u-th class="u-th">所占比例</u-th>
									<u-th class="u-th">当日同比</u-th>
									<u-th class="u-th">累计成交</u-th>
									<u-th class="u-th">所占比例</u-th>
									<u-th class="u-th">累计同比</u-th>
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList5" :key="index">
									<u-td class="u-td">{{item.name}}</u-td>
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
								</u-tr>
							</u-table>	
						</view>
					</scroll-view>
				</swiper-item>			
				<!-- 6 -->
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<u-table>
								<u-tr class="u-tr">
									<u-th class="u-th">排名</u-th>
									<u-th class="u-th">商品名称</u-th>
									<u-th class="u-th">累计成交</u-th>
									<u-th class="u-th">所占比例</u-th>
									<u-th class="u-th">累计同比</u-th>
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList6" :key="index">
									<u-td class="u-td">{{index}}</u-td>
									<u-td class="u-td">{{item.name}}</u-td>
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
									</u-tr>
								</u-table>							
						
						</view>
					</scroll-view>
				</swiper-item>
				
				<!-- 7 -->
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<u-table>
								<u-tr class="u-tr">
									
									<u-th class="u-th">排名</u-th>
									<u-th class="u-th">a</u-th>
									<u-th class="u-th">企业名称</u-th>
									<u-th class="u-th">隶属交易团</u-th>
								
									<u-th class="u-th">累计成交</u-th>
									<u-th class="u-th">所占比例</u-th>
						
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList7" :key="index">
									<u-td class="u-td">{{item.name}}</u-td>
									<u-td class="u-td">{{item.date}}</u-td>
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
								</u-tr>
								</u-table>							
			
						</view>
					</scroll-view>
				</swiper-item>			
				<!-- 8 -->
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<u-table>
								<u-tr class="u-tr">
									
									<u-th class="u-th" rowspan="3">国家/地区</u-th>
									<u-th class="u-th" colspan="2" rowspan="2">总值</u-th>
									<u-th class="u-th" colspan="2" rowspan="2">纺织服装类</u-th>
									<u-th class="u-th" colspan="4">其中</u-th>
									<u-th class="u-th" colspan="2" rowspan="2">轻工工艺类</u-th>
									<u-th class="u-th" colspan="2" rowspan="2">其他商品类</u-th>
								</u-tr>
								<u-tr class="u-tr">
									
									
									
									<u-th class="u-th" colspan="2">服装类</u-th>
									<u-th class="u-th" colspan="2">纺织类</u-th>
									
								</u-tr>
								
								
								<u-tr class="u-tr">
									
									
									<u-th class="u-th" >金额</u-th>
									<u-th class="u-th">同比</u-th>
									
									<u-th class="u-th" >金额</u-th>
									<u-th class="u-th">同比</u-th>
									
									
									
									<u-th class="u-th" >金额</u-th>
									<u-th class="u-th">同比</u-th>
									
									<u-th class="u-th" >金额</u-th>
									<u-th class="u-th">同比</u-th>
									
									<u-th class="u-th" >金额</u-th>
									<u-th class="u-th">同比</u-th>
									
									<u-th class="u-th" >金额</u-th>
									<u-th class="u-th">同比</u-th>
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList8" :key="index">
									<u-td class="u-td">{{item.name}}</u-td>
									<u-td class="u-td">{{item.date}}</u-td>
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
									</u-tr>
								</u-table>							
							
						</view>
					</scroll-view>
				</swiper-item>
					
				<!-- 9 -->
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="page-box">
							<u-table>
								<u-tr class="u-tr">
									<u-th class="u-th" rowspan="2">商品名称</u-th>
									<u-th class="u-th" rowspan="2">单位</u-th>
									<u-th class="u-th">当天成交</u-th>
									<u-th class="u-th">上届当天</u-th>
								
									<u-th class="u-th">当天同比</u-th>
									<u-th class="u-th">累计成交</u-th>
									
									<u-th class="u-th">上届累计</u-th>
									<u-th class="u-th">累计同比</u-th>
						
								</u-tr>
								<u-tr class="u-tr">
								
									<u-th class="u-th" >数量</u-th>
									<u-th class="u-th">金额</u-th>
									<u-th class="u-th">数量</u-th>
									<u-th class="u-th">金额</u-th>
								
									<u-th class="u-th">数量</u-th>
									<u-th class="u-th">金额</u-th>
									
									<u-th class="u-th">数量</u-th>
									<u-th class="u-th">金额</u-th>
									<u-th class="u-th">金额</u-th>				
								</u-tr>
								<u-tr class="u-tr" v-for="(item, index) in dataList9" :key="index">
									<u-td class="u-td">{{item.name}}</u-td>
									<u-td class="u-td">{{item.date}}</u-td>
									<u-td class="u-td">{{item.same_day_deal}}</u-td>
									<u-td class="u-td">{{item.last_same_day}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.same_day_deal,item.last_same_day) }}%</u-td>
									<u-td class="u-td">{{item.cumulative_deal}}</u-td>
									<u-td class="u-td">{{item.last_cumulative_deal}}</u-td>
									<u-td class="u-td">{{ priceDecimal(item.cumulative_deal,item.last_cumulative_deal) }}%</u-td>
								</u-tr>
								</u-table>							
							
						</view>
					</scroll-view>
				</swiper-item>			
					
						
			</swiper>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			orderList: [[], [], [], []],
			dataList: [
				{
					name:'上海海岸展览有限公司',
					date: "2020-1-1",
					same_day_deal: '18781',
					last_same_day: '16024',
					year_on_year:'17.20%',
					cumulative_deal:'18781',
					last_cumulative_deal:'16024',
					last_year_on_year:'17.20%'
				}
			],
			dataList1:[],
			dataList2:[],
			dataList3:[],
			dataList4:[],
			dataList5:[],
			dataList6:[],
			dataList7:[],
			dataList8:[],
			dataList9:[],
			list: [
				{
					name: '华交会大类商品出口成交统计',
					count: 0
				},
				{
					name: '华东交易团出口成交统计',
					count: 0
				},
				{
					name: '华交会出口成交主要国家(地区)统计',
					count: 0
				},
				{
					name: '华交会交易团分国别(地区)出口成交统计',
					count: 0
				},
				{
					name: '华交会各类企业出口成交统计',
					count: 0
				},
				{
					name: '华交会出口成交前15位商品统计',
					count: 0
				},
				{
					name: '华交会出口成交前20名企业统计',
					count: 0
				},
				{
					name: '华交会出口商品分国别(地区)成交统计',
					count: 0
				},
				{
					name: '华交会明细商品出口成交统计',
					count: 0
				}
			],
			sectionCurrent: 0,
			isScroll: true,
			tabCountIndex: 0,
			activeColor: this.$u.color['primary'],
			bold: true,
			control: true,
			offset: [5, -5],
			
			current: 0,
			swiperCurrent: 0,
			tabsHeight: 0,
			dx: 0,
			loadStatus: ['loadmore','loadmore','loadmore','loadmore'],
		};
	},
	onLoad() {
		this.getOrderList(0);
	},
	computed: {
	

	},
	methods: {
		reachBottom() {
			// 此tab为空数据
			if(this.current != 2) {
				this.loadStatus.splice(this.current,1,"loading")
				setTimeout(() => {
					this.getOrderList(this.current);
				}, 1200);
			}
		},
		// 页面数据
		getOrderList(idx) {
			this.dataList = this.dataList
		},
		// 总价
		totalPrice(item) {
			let price = 0;
			item.map(val => {
				price += parseFloat(val.price);
			});
			return price.toFixed(2);
		},
		// 总件数
		totalNum(item) {
			let num = 0;
			item.map(val => {
				num += val.number;
			});
			return num;
		},
		// tab栏切换
		change(index) {
			console.log(index)
			this.current = index;
			this.swiperCurrent = index;
			this.getOrderList(index);
		},
		transition({ detail: { dx } }) {
			this.$refs.tabs.setDx(dx);
		},
		animationfinish({ detail: { current } }) {
			this.$refs.tabs.setFinishCurrent(current);
			this.swiperCurrent = current;
			this.current = current;
		},
		priceDecimal(a,b){
			var num = (a-b)/b *100
			let tempVal = parseFloat(num).toFixed(3)
			let realVal = tempVal.substring(0, tempVal.length - 1)
			return realVal
		}
	}
};
</script>

<style>
/* #ifndef H5 */
page {
	height: 100%;
	background-color: #f2f2f2;
}
/* #endif */
</style>

<style lang="scss" scoped>
.order {
	width: 710rpx;
	background-color: #ffffff;
	margin: 20rpx auto;
	border-radius: 20rpx;
	box-sizing: border-box;
	padding: 20rpx;
	font-size: 28rpx;
	.top {
		display: flex;
		justify-content: space-between;
		.left {
			display: flex;
			align-items: center;
			.store {
				margin: 0 10rpx;
				font-size: 32rpx;
				font-weight: bold;
			}
		}
		.right {
			color: $u-type-warning-dark;
		}
	}
	.item {
		display: flex;
		margin: 20rpx 0 0;
		.left {
			margin-right: 20rpx;
			image {
				width: 200rpx;
				height: 200rpx;
				border-radius: 10rpx;
			}
		}
		.content {
			.title {
				font-size: 28rpx;
				line-height: 50rpx;
			}
			.type {
				margin: 10rpx 0;
				font-size: 24rpx;
				color: $u-tips-color;
			}
			.delivery-time {
				color: #e5d001;
				font-size: 24rpx;
			}
		}
		.right {
			margin-left: 10rpx;
			padding-top: 20rpx;
			text-align: right;
			.decimal {
				font-size: 24rpx;
				margin-top: 4rpx;
			}
			.number {
				color: $u-tips-color;
				font-size: 24rpx;
			}
		}
	}
	.total {
		margin-top: 20rpx;
		text-align: right;
		font-size: 24rpx;
		.total-price {
			font-size: 32rpx;
		}
	}
	.bottom {
		display: flex;
		margin-top: 40rpx;
		padding: 0 10rpx;
		justify-content: space-between;
		align-items: center;
		.btn {
			line-height: 52rpx;
			width: 160rpx;
			border-radius: 26rpx;
			border: 2rpx solid $u-border-color;
			font-size: 26rpx;
			text-align: center;
			color: $u-type-info-dark;
		}
		.evaluate {
			color: $u-type-warning-dark;
			border-color: $u-type-warning-dark;
		}
	}
}
.centre {
	text-align: center;
	margin: 200rpx auto;
	font-size: 32rpx;
	image {
		width: 164rpx;
		height: 164rpx;
		border-radius: 50%;
		margin-bottom: 20rpx;
	}
	.tips {
		font-size: 24rpx;
		color: #999999;
		margin-top: 20rpx;
	}
	.btn {
		margin: 80rpx auto;
		width: 200rpx;
		border-radius: 32rpx;
		line-height: 64rpx;
		color: #ffffff;
		font-size: 26rpx;
		background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
	}
}
.wrap {
	display: flex;
	flex-direction: column;
	height: calc(100vh - var(--window-top));
	width: 100%;
}
.swiper-box {
	flex: 1;
}
.swiper-item {
	height: 100%;
}
</style>
